package com.g8.pethospitallearnbackend.entity;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

public class Exam implements Serializable {
    private String examId;

    private String paperId;

    private String examName;

    private Integer examTime;

    private LocalDateTime examDdl;

    private Paper paper;

    private List<ExamStu> examStus;

    public static class ExamStu{
        String stuId;
        LocalDateTime enterTime;
        Integer grade;

        public ExamStu(String stuId, LocalDateTime time, Integer grade){
            this.stuId = stuId;
            this.enterTime = time;
            this.grade = grade;
        }

        public ExamStu(){}

        public String getStuId() {
            return stuId;
        }

        public Integer getGrade() {
            return grade;
        }

        public LocalDateTime getEnterTime() {
            return enterTime;
        }

        public void setEnterTime(LocalDateTime enterTime) {
            this.enterTime = enterTime;
        }

        public void setGrade(Integer grade) {
            this.grade = grade;
        }

        public void setStuId(String stuId) {
            this.stuId = stuId;
        }
    }

    public void setExamStus(List<ExamStu> examStus) {
        this.examStus = examStus;
    }

    public List<ExamStu> getExamStus() {
        return examStus;
    }

    public Paper getPaper() {
        return paper;
    }

    public void setPaper(Paper paper) {
        this.paper = paper;
    }

    private static final long serialVersionUID = 1L;

    public String getExamId() {
        return examId;
    }

    public void setExamId(String examId) {
        this.examId = examId;
    }

    public String getPaperId() {
        return paperId;
    }

    public void setPaperId(String paperId) {
        this.paperId = paperId;
    }

    public String getExamName() {
        return examName;
    }

    public void setExamName(String examName) {
        this.examName = examName;
    }

    public Integer getExamTime() {
        return examTime;
    }

    public void setExamTime(Integer examTime) {
        this.examTime = examTime;
    }

    public LocalDateTime getExamDdl() {
        return examDdl;
    }

    public void setExamDdl(LocalDateTime examDdl) {
        this.examDdl = examDdl;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", examId=").append(examId);
        sb.append(", paperId=").append(paperId);
        sb.append(", examName=").append(examName);
        sb.append(", examTime=").append(examTime);
        sb.append(", examDdl=").append(examDdl);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Exam other = (Exam) that;
        return (this.getExamId() == null ? other.getExamId() == null : this.getExamId().equals(other.getExamId()))
            && (this.getPaperId() == null ? other.getPaperId() == null : this.getPaperId().equals(other.getPaperId()))
            && (this.getExamName() == null ? other.getExamName() == null : this.getExamName().equals(other.getExamName()))
            && (this.getExamTime() == null ? other.getExamTime() == null : this.getExamTime().equals(other.getExamTime()))
            && (this.getExamDdl() == null ? other.getExamDdl() == null : this.getExamDdl().equals(other.getExamDdl()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getExamId() == null) ? 0 : getExamId().hashCode());
        result = prime * result + ((getPaperId() == null) ? 0 : getPaperId().hashCode());
        result = prime * result + ((getExamName() == null) ? 0 : getExamName().hashCode());
        result = prime * result + ((getExamTime() == null) ? 0 : getExamTime().hashCode());
        result = prime * result + ((getExamDdl() == null) ? 0 : getExamDdl().hashCode());
        return result;
    }
}